var httpsUrl = getApp().globalData.httpsUrl;
var globalData = getApp().globalData;
var commonUtil = require("../../../utils/commonUtil.js")
Page({

  data: {
    imgUrl: globalData.imgUrl,
  },
  onLoad: function (options) {
    let that = this;
    let openId = wx.getStorageSync("openidKey");
    wx.request({
      header: { "openId": openId, "content-Type": "application/x-www-form-urlencoded" },
      url: httpsUrl + "/member/info",
      dataType: "json",
      method: "GET",
      // data: { "openId": data.openid },
      success: function (res) {
        res = res.data;
        console.log("userInfo:" + JSON.stringify(res));
        if (res.result == 0) {
          var user = res.data;
          let codeUrl = httpsUrl + "/wechat/getXcxCode?scene=" + user.member_no + "&agentCode=" + globalData.agentCode;
          that.setData({ codeUrl: codeUrl })
          console.log(codeUrl);
        } else if (res.result == 2) {
          wx.showModal({title: '提示',content: '用户未注册',})
        }
      }
    })
  },
})